//package com.cloud.scheduledbalance;
//
//
//import com.cloud.scheduledbalance.annotaion.ScheduledBalance;
//import org.aspectj.lang.JoinPoint;
//import org.aspectj.lang.ProceedingJoinPoint;
//import org.aspectj.lang.annotation.Around;
//import org.aspectj.lang.annotation.Aspect;
//import org.aspectj.lang.annotation.Pointcut;
//import org.redisson.api.RLock;
//import org.redisson.api.RedissonClient;
//import org.springframework.beans.factory.annotation.Autowired;
//
///**
// * @author: create by God of SJF
// * @version: v1.0
// * @description: com.cloud.observer
// * @date:2021/1/12
// */
//@Aspect
//public class ScheduledBalanceAspect {
//
//    @Autowired
//    RedissonClient redissonClient;
//
//
//
//    @Pointcut(value = "@annotation(org.springframework.scheduling.annotation.Scheduled)")
//    public void cut() {
//    }
//
//    @Around("cut() && @annotation(scheduledBalance)")
//    public void around(ProceedingJoinPoint point, ScheduledBalance scheduledBalance) throws Throwable {
//        RLock lock = redissonClient.getLock(point.getSignature().getDeclaringTypeName());
//        lock.lock();
//        point.proceed();
//        lock.unlock();
//    }
//
//
//    public String key(JoinPoint joinPoint) {
//        String className = joinPoint.getSignature().getDeclaringTypeName();
//        String methodName = joinPoint.getSignature().getName();
//        String key = className.substring(className.lastIndexOf(".") + 1, className.length()) + "-" + methodName;
//        return key;
//    }
//}
